package com.serviceImpl;

import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.util.List;
import java.util.Map;

import org.hibernate.SessionFactory;








import com.bean.Craft;
import com.bean.CraftShow;
import com.dao.CraftDao;



public class CraftServiceImpl {

	private CraftDao craftDao;	//工艺dao类
	
	
	
	//封装
	public CraftDao getCraftDao() {
		return craftDao;
	}

	public void setCraftDao(CraftDao craftDao) {
		this.craftDao = craftDao;
	}

	
	/**
	 *获得工艺编码servlet 
	 */
	public String getCrafCodeByType(int craftType){
		return craftDao.getCodeByType(craftType);
	}
	
	
	/**
	 * 添加工艺servlet
	 */
	public void saveCraft(Craft craft){
		
		craftDao.save(craft);
	}
	
	/**
	 * 根据id获取工艺
	 */
	public CraftShow getByidCraft (int craftId){
		
		return craftDao.findByCraft(craftId);
		
	}
	
	/**
	 * 查询所有的工艺
	 */
	public List<CraftShow> getAllCraft(String table,String pk,String sort,int PageNumber,int PageSize ,String options){
		
		return craftDao.getFindCraft(table, pk, sort, PageNumber, PageSize, options);
				
	}
	
	/**
	 * 修改工艺信息
	 */
	public void mergeCraft(Craft craft){
		
		craftDao.merge(craft);
	}
	
	/**
	 * 删除工艺信息
	 */
	public boolean delByCraft(Integer craftId){
		Craft craft = craftDao.findById(craftId);
		craftDao.delete(craft);
		return true;
	}
}
